<template>
    <div class="fix nav boder4">
        <div class=" none">
            <p class="bold16"> {{title}}</p>
        </div>
        <div class="">
            <div class="">
                <div class="">
                    <div class="navs">
                        <div class="na " @click="getExperts(lis.itemKey)" v-for="lis in tabList"><p>{{lis.itemValue}}</p>  </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
   import bus from '../../common/common.js';
    export default {
        name: "my-nav",
        created(){
            this.getList();
        },
        data(){
            return  {
                 "title":"专家在线",
                tabList:[],
                Authorization:''
            }
        },
        methods: {
            // sec(text){
            //     alert("1");
            //     alert(this.ChildByNavToList);
            //     for (var  i in this.list){
            //         if(text.text==this.list[i].text){
            //             this.list[i].status="1";

            //         }else{
            //             this.list[i].status="2";
            //         }
            //     }
            // },
            // tab列表
            getList(){
                var url='/api/basic/basicDicts/expect_group/list';
                 this.Authorization=localStorage.getItem('access_token')
                // console.log(Authorization)
                this.$http.get(url, {
                    headers: {
          Authorization: 'bearer '+ this.Authorization,
                    }
                }).then(function(res){
                    this.tabList=res.body
                    res.body.unshift({itemValue:'全部',itemKey:'expect_group'})
                })
            },
            getExperts(itemKey){
                 var url='/api/organization/employees/'+itemKey+'/list';
                 this.$http.get(url,{
                    headers:{
                         Authorization: 'bearer '+ this.Authorization,
                    }
                 }).then(function(res){
                    //  console.log(res);
                    bus.$emit('employees',res.body);

                 })
            }
        },
        computed: {
            ChildByNavToList: function () {

            }
        }
    }
</script>
